package com.qili.service.base.impl;

import com.qili.base.mapper.BaseMapper;
import com.qili.base.service.impl.BaseServiceImpl;
import com.qili.entity.base.BaseDict;
import com.qili.mapper.base.BaseDictMapper;
import com.qili.service.base.BaseDictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;

/**
 * @author zhaoyongke
 * @date 2020/10/23
 * @description
 */

@Service
public class BaseDictServiceImpl extends BaseServiceImpl<BaseDict,String>  implements BaseDictService {

    @Autowired
    private BaseDictMapper baseDictMapper;

    @Override
    public List<BaseDict> select(BaseDict baseDict) {
        return baseDictMapper.select(baseDict);
    }

    public BaseMapper<BaseDict, String> getMappser() {
        return baseDictMapper;
    }

    @Override
    public List<BaseDict> selectByTypeCode(String  code) {
        return baseDictMapper.getDicList(code);
    }

    @Override
    public String selectMaxCodeByTypeCode(String typeCode) {
        return baseDictMapper.selectMaxCodeByTypeCode(typeCode);
    }

    @Override
    public boolean ifExited(String typeCode, String name) {
        BaseDict exitedBaseDict = new BaseDict();
        exitedBaseDict.setBadtTypecode(typeCode);
        exitedBaseDict.setBadtName(name);
        return baseDictMapper.selectOne(exitedBaseDict) != null;
    }

    @Override
    public Map getGuideTextLen(BaseDict baseDict) {
        return baseDictMapper.getGuideTextLen(baseDict);
    }

    @Override
    public void deleteGuideFromDict(BaseDict baseDict) {
        baseDict.setBadtLevel9(null);
        baseDictMapper.updateGuideFromDict(baseDict);
    }

    @Override
    public void updateMilepostGuide(BaseDict baseDict) {
        baseDictMapper.updateGuideFromDict(baseDict);
    }

    @Override
    public List<BaseDict> selectYw(String code) {
        return baseDictMapper.selectYw(code);
    }

    @Override
    public List<BaseDict> selectIndustry() {
        return baseDictMapper.selectIndustry();
    }

    @Override
    public List<BaseDict> selectSupplierType() {
        return baseDictMapper.selectSupplierType();
    }

    @Override
    public List<BaseDict> selectZxYw(String typeCode) {
        return baseDictMapper.selectZxYw(typeCode);
    }

}
